#include <iostream>
#include <cstdio>
#include <bitset>

using namespace std;

const int n=2048;
const int dig=11;
const int end=n*n;
const int strsize=n*(n+5);
const int line=1<<dig;
const int colmask=line-1;
char str[strsize];
bitset<end> _bit[2];

inline int read(){
  char c;int r;bool f=0;
  for(c=getchar();c>'9'||c<'0';c=getchar()) if(c=='-') f=1;
  for(r=0;c<='9'&&c>='0';c=getchar()) r=r*10+c-'0';
  if(f) return -r;
  else return r;
}

int main(){
  int T,p,q;

  freopen("Optimization.in","r",stdin);
  freopen("Optimization.out","w",stdout); 

  read();read();T=read();
  int len=fread(str,1,strsize,stdin);
  int pos=0;
  for(char *s=str,*t=str+len;s!=t;s++){
    if(*s=='*') _bit[0][pos++]=1;
    else if(*s=='.') pos++;
  }

  p=0;q=1;

  while(T--){
    int lstrow,currow,nxtrow,lstcol,nxtcol,curcol;
    bitset<end> &bit=_bit[p];
    bitset<end> &newbit=_bit[q];
    lstrow=(n-2)<<dig;nxtrow=0;
    for(pos=0;pos<end;pos++){
	if(!(pos&colmask)){
	  lstrow+=line;nxtrow+=line;
	  currow=pos;
	  if(nxtrow^end) nxtrow=0;
	  lstcol=colmask;nxtcol=1;curcol=0;
	}
	register int cnt=0;
	if(bit[lstrow|lstcol]) cnt++;
	if(bit[lstrow|curcol]) cnt++;
	if(bit[lstrow|nxtcol]) cnt++;
	if(bit[currow|lstcol]) cnt++;
	if(bit[currow|nxtcol]) cnt++;
	if(bit[nxtrow|lstcol]) cnt++;
	if(bit[nxtrow|curcol]) cnt++;
	if(bit[nxtrow|nxtcol]) cnt++;
	if(bit[pos]){
	  if(cnt==2||cnt==3);
	  else newbit[pos]=0;
	}else if(cnt==3) newbit[pos]=1;
	if(lstcol^colmask) lstcol++;
	else lstcol=0;
	curcol++;nxtcol++;
    }
    swap(p,q);
  }
    int ans=0;
    for(pos=0;pos<end;pos++) if(_bit[p][pos]) ans++;
    printf("%d\n",ans);

  return 0;
}
